# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import json

class MeituanPipeline(object):
    def process_item(self, item, spider):
        return item


class Meituan2Pipeline(object):
    def process_item(self, item, spider):
        return item

class Meituan3Pipeline(object):

    def open_spider(self, spider):
        self.file = open('美团优惠券.txt', 'w')

    def close_spider(self, spider):
        self.file.close()

    def process_item(self, item, spider):
        if spider.name == 'meituan3':
            self.file.write(str(item)+"\n")
        return item
